﻿@page "/"
@using Console = System.Console

@attribute [TabItemOption(Text = "Index", Closable = false)]
<PageTitle>Index</PageTitle>

<h1>Hello, world!</h1>


<div class="row g-3">
    <div class="col-12 col-sm-6">
        <TreeView TItem="object" Items="@Items" OnTreeItemClick="@OnTreeItemClick"/>
    </div>
    <div class="col-12 col-sm-6">
        @name
        <BootstrapInput @bind-Value="@name"/>
    </div>
</div>

<SurveyPrompt Title="How is Blazor working for you?"/>

@code
{
    public string name { get; set; }

    protected override void OnInitialized()
    {
        base.OnInitialized();
        Items.Add(new TreeViewItem<object>(new object()) { Text = "1" });
        Items.Add(new TreeViewItem<object>(new object()) { Text = "2" });
        Items.Add(new TreeViewItem<object>(new object()) { Text = "3" });
    }

    public List<TreeViewItem<object>> Items { get; set; } = new List<TreeViewItem<object>>();

    private Task OnTreeItemClick(TreeViewItem<object> arg)
    {
        Console.WriteLine($"name="+name);
        return Task.CompletedTask;
    }
}
